package phone.example.com.a36kr.fragment.investfragment;

import android.widget.ListView;

import phone.example.com.a36kr.R;
import phone.example.com.a36kr.adapter.InvestListViewAdapter;
import phone.example.com.a36kr.bean.InvestBean;
import phone.example.com.a36kr.nettool.NetTool;
import phone.example.com.a36kr.tools.BaseFragment;
import phone.example.com.a36kr.tools.MyApp;

/**
 * Created by dllo on 16/8/17.
 */
public class RaiseNowFragment extends BaseFragment{

    private ListView lv;
    private InvestListViewAdapter investViewPagerAdapter;
    private String url = "https://rong.36kr.com/api/mobi/cf/actions/list?page=1&type=underway&pageSize=20";
    @Override
    protected int setLayout() {
        return R.layout.fragment_raise_all;
    }

    @Override
    protected void initView() {
        lv = bindView(R.id.raise_all_lv);
        investViewPagerAdapter = new InvestListViewAdapter(MyApp.getContext());
    }

    @Override
    protected void initData() {
        NetTool netTool = new NetTool();
        netTool.getNetData(url, InvestBean.class, new NetTool.NetListener<InvestBean>() {
            @Override
            public void onSuccess(InvestBean investBean) {
                lv.setAdapter(investViewPagerAdapter);
                investViewPagerAdapter.setInvestBean(investBean);
            }

            @Override
            public void onError(String errorMsg) {

            }
        });

    }
}
